package com.atguigu.controller;

import com.atguigu.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
 * TestController
 *
 * @Author: 马伟奇
 * @CreateTime: 2021-02-23
 * @Description:
 *
 * @Controller:表示跳转页面
 * @RestController:不跳转页面，直接显示
 */
@Controller
@RequestMapping("/test")
public class TestController {


    @RequestMapping("/hello")
    public String hello(Model model){
//        model.addAttribute("hello","hello welcome");


        //集合数据
//        List<User> users = new ArrayList<User>();
//        users.add(new User(1,"张三","深圳"));
//        users.add(new User(2,"李四","北京"));
//        users.add(new User(3,"王五","武汉"));
//        model.addAttribute("users",users);

//        Map<String,Object> dataMap = new HashMap<String,Object>();
//        dataMap.put("No","123");
//        dataMap.put("address","深圳");
//        model.addAttribute("dataMap",dataMap);

//        model.addAttribute("now",new Date());

        model.addAttribute("age",22);
        return "demo1";
    }

}